package com.lin.operatorlogrecord.strategy;

import com.lin.operatorlogrecord.content.ObjectAddLogUtil;
import com.lin.operatorlogrecord.exception.OperatorLogException;
import com.lin.operatorlogrecord.unit.OperatorLogUtil;

/**
 * @Author: chenghao.lin
 * @Date: 2023/09/25
 * @Description: 新增生成变更内容模板
 */
public class AddOperatorLogStrategy implements IOperateLogStrategy{

    @Override
    public String getOperatorContent(Object requestObj, Class<?>[] tableEntity, String operatorObjId) {
        ObjectAddLogUtil objectAddLogUtil = new ObjectAddLogUtil();
        String content;
        try {
            content = objectAddLogUtil.generatorContent(requestObj, OperatorLogUtil.getObjectTypeEnum(tableEntity[0]).getName());
        } catch (Exception e) {
            throw new OperatorLogException("生成新增操作日志失败", e);

        }
        return content;
    }
}
